package Simple;

import java.util.*;
import java.io.*;

public class bottle4 {
/**
 * 4只瓶子其中一个比较沉，找出那个
 * @param args
 */
	public static void main(String[] args) {
		int[] T = { 12, 17, 12, 12 };
		getTrue(T);
	}

	/**
	 * One of the bottle is heavier than others, and it is a faked one, find it.
	 * @param T   ----a series number of the weight of bottle
	 */
	public static void getTrue(int[] T) {
		int flag = 0;
		for (int i = 0; i < T.length; i++) {
			if (flag == 0) {
				for (int j = 0; j < T.length; j++) {
					if (flag == 0) {
						for (int k = 0; k < T.length; k++) {
							if (flag == 0) {
								if (i != j && j != k && i != k) {
									if (T[i] == T[j] && T[j] == T[k]) {
										System.out.println("合格的产品已经找到： " + i
												+ j + k);
										flag = 1;
										break;
									} else {
										System.out.println("算法仍在继续....");
									}
								}
							} else {
								break;
							}
						}
					} else {
						break;
					}
				}
			} else {
				break;
			}
		}
	}

}
